package com.ruihu.admin.module.business.log.interfacelog.constant;

import com.ruihu.admin.common.domain.BaseEnum;

import java.util.Arrays;
import java.util.Optional;

public enum InterfaceModuleEnum implements BaseEnum {

    SEND_ADD_MSG_TO_AI("AI-发送新增编码", "AI-发送新增编码"),

    SEND_UPDATE_MSG_TO_AI("AI-发送更新编码", "AI-发送更新编码"),

    SEND_ADD_POLE_GROUP_MSG_TO_AI("AI-发送极组新增编码", "AI-发送极组新增编码"),

    SEND_UPDATE_POLE_GROUP_MSG_TO_AI("AI-发送极组更新编码", "AI-发送极组更新编码"),

    RECEIVE_AI_IMAGE("AI-接受图片", "AI-接受图片");


    private String moduleName;

    private String moduleDesc;

    InterfaceModuleEnum(String moduleName, String moduleDesc) {
        this.moduleName = moduleName;
        this.moduleDesc = moduleDesc;
    }

    @Override
    public String getValue() {
        return this.moduleName;
    }

    @Override
    public String getDesc() {
        return this.moduleDesc;
    }

    public static InterfaceModuleEnum of(String value) {
        InterfaceModuleEnum[] values = InterfaceModuleEnum.values();
        Optional<InterfaceModuleEnum> first = Arrays.stream(values).filter(e -> e.getValue().equals(value)).findFirst();
        return !first.isPresent() ? null : first.get();
    }

    public static boolean isExist(String value) {
        InterfaceModuleEnum interfaceModuleEnum = of(value);
        return interfaceModuleEnum != null;
    }
}
